define(function(require,exports,module){
	var Subnav = require("subnav");
	var aw = require("ajaxwrapper");
	
	module.exports = {
		initComponent: function(params,widget){
			var subnav = new Subnav({
				parentNode: ".J-subnav",
				model: {
					title: "退证审批",
					items: [{
						id:"search",
						type: "search",
						placeholder: "会员证号/会员/合同号",
						handler: function(str){
							aw.ajax({
								url: "api/returncredentials/search",
								data: {
									s: str,
									properties: "travelContract.memberCertificates,travelContract.contactNo,travelContract.member.personalInfo.name,",
//									fetchProperties: widget.constant.fetchProperties 
									fetchProperties:"*,travelContract.*,travelContract.member.personalInfo.*,travelContract.productRule.product.*,travelContract.productType.*"
								},
								success: function(data){
									widget.get("grid").setData(data);
								}
							});
						}
					},{
						id:"status",
						type: "buttongroup",
						tip: "审批状态",
						items: [{
							key: "Approvaling",
							value: "待审批"
						},{
							key: "Initial",
							value: "初始"
						},{
							key: "Approved",
							value: "通过"
						},{
							key: "NotApproved",
							value: "未通过"
						}],
						all: {
							show: true,
							position: "bottom"
						},
						handler: function(key){
							widget.get("grid").refresh();
						}
					},{
						id:"back",
						type:"button",
						text:"返回",
						show : false,
						handler:function(){
							widget.toGrid();
						}
					}]
				}
			});
			
			widget.set("subnav",subnav);
		}
	};
});